  <script type="text/javascript"><!--//--><![CDATA[//><!--

    $(document).ready(function() {


        // Setup Form
        $('#form_master').setupForm([
            { name: 'id_tempat', type: 'text', size: 'short', readonly:true , maxlength: 10, },
            { name: 'no_toko', type: 'text', size: 'medium', maxlength: 30, noempty:true },
            { name: 'lokasi_tempat', type: 'lov', size: 'long', data : <?php echo json_encode($lokasi_tempat)?> },
            { name: 'luas_tempat', type: 'text', size: 'short', maxlength: 30, noempty:true },
            { name: 'harga_sewa', type: 'text', size: 'long', maxlength: 255, noempty:true },
            { name: 'status_sewa', type: 'text', size: 'long', maxlength: 255, noempty:true },
        ], <?php echo json_encode($data); ?>);
        
        <?php if ($mode=='create') {
                ?>
                var id_tempat = "<?php echo $id_tempat; ?>";
                var id_sewa = '<?php echo $id_sewa_auto; ?>';
                $('#id_tempat').setval(id_tempat);
                $('#id_sewa').setval(id_sewa);
                <?php
            }
        ?>
             
        <?php if($mode=="edit"){ ?>
       /* var id_tempat_edit = "<?php echo $id_tempat_edit; ?>";*/
        var id_sewa_edit = "<?php echo $id_sewa_edit; ?>";
        var id_lokasi_edit = "<?php echo $id_lokasi_edit; ?>";
        $('#id_tempat').readonly();
        /*$('#id_tempat').setval(id_tempat_edit);*/
        $('#id_sewa').setval(id_sewa_edit);
        $('#id_lokasi').setval(id_lokasi_edit);
        //alert(id_tempat_edit);
        <?php } ?>

        $('#lokasi_tempat').change(function(){
            var selectedValue = this.value;
            $.ajax({
                url: gs_path+'/'+controller+'/getIdLokasi/',
                type: 'POST',
                dataType: 'json',
                data: {option : selectedValue},
            }).done(function(data){
                var id_lokasi = data['id_lokasi'];
                //alert(data['id_lokasi']);
                $('#id_lokasi').setval(id_lokasi);
            });
        });
        
        // Set Action Button
        var buttons = [{ label: 'Save', icon: 'save', onclick: function() { 
                            $('#form_master').submitForm(   '/'+controller+'/ajax_post'  );
                           /* $.ajax({
                                url: gs_path+'/'+controller+'/getIdAuto/',
                                type: 'POST',
                                dataType: 'json',
                                data: {option : null},
                             }).done(function(data){
                                var no_auto = data['no_auto'];
                                //alert(no_auto);
                                $('#no').setval(no_auto);
                             });*/ 
                        }},
                       { label: 'Close', icon: 'cancel', onclick: function() { loadPage('/'+controller+'/Index'); } }];
        setAction(buttons);


        // Create Tab
        $('#tt').tabs({ border:false });  
        
        // Focus at First Object
        $('#form_master').focusFirst();

    });




//--><!]]></script>

<div id="form_master_message" style="display:none;"></div>
    <table class="tb_form" style="width:100%;" cellpadding="0" cellspacing="0">
    <tr>
        <td><input id="id_sewa" name="id_sewa" type="hidden" /><input id="id_lokasi" name="id_lokasi" type="hidden" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">ID Tempat</td>
        <td><input id="id_tempat" /></td>
    </tr>    
    <tr>
        <td class="label" style="width:150px">No Toko</td>
        <td><input id="no_toko" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Lokasi Tempat</td>
        <td><input id="lokasi_tempat" name="lokasi_tempat"/></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Luas Tempat</td>
        <td><input id="luas_tempat" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Harga Sewa</td>
        <td><input id="harga_sewa" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Status Sewa</td>
        <td><select id="status_sewa" name="status_sewa">
                <option value="Belum Di Sewa">Belum Di Sewa</option>
                <option value="Sudah Di Sewa">Sudah Di Sewa</option>
            </select></td>
    </tr>
</table>
